//
//  FFBankcardAddVC.m
//  LLWallet
//
//  Created by tt on 2020/9/14.
//

#import "FFBankcardAddVC.h"
#import "FFBankcardAddVM.h"
@interface FFBankcardAddVC ()

@property(nonatomic,strong) UIView *tipBox;
@property(nonatomic,strong) UIImageView *warnImgView;
@property(nonatomic,strong) UILabel *tipLbl;
@end

@implementation FFBankcardAddVC

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.viewModel = [FFBankcardAddVM shared];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view addSubview:self.tipBox];
    [self.tipBox addSubview:self.tipLbl];
    [self.tipBox addSubview:self.warnImgView];
    
    self.tableView.lim_top = self.tipBox.lim_bottom;
    
    __weak typeof(self) weakSelf = self;
    [self.viewModel getNameAuthInfo].then(^{
        [weakSelf reloadData];
        if(weakSelf.viewModel.nameAuthResp) {
            weakSelf.tableView.lim_top = weakSelf.navigationBar.lim_bottom;
            weakSelf.tipBox.hidden = YES;
        }else {
            weakSelf.tipBox.hidden = NO;
        }
    });
}

- (NSString *)langTitle {
    return LLang(@"添加银行卡");
}

- (UIView *)tipBox {
    if(!_tipBox) {
        _tipBox = [[UIView alloc] initWithFrame:CGRectMake(0.0f, self.navigationBar.lim_bottom, WKScreenWidth, 54.0f)];
        [_tipBox setBackgroundColor:[UIColor colorWithRed:255.0f/255.0f green:241.0f/255.0f blue:237.0f/255.0f alpha:1.0f]];
        _tipBox.hidden = YES;
    }
    return _tipBox;
}

- (UIImageView *)warnImgView {
    if(!_warnImgView) {
        _warnImgView = [[UIImageView alloc] initWithFrame:CGRectMake(15.0f, 12.0f, 16.0f, 16.0f)];
        [_warnImgView setImage:[self imageName:@"tip_warn"]];
    }
    return _warnImgView;
}

- (UILabel *)tipLbl {
    if(!_tipLbl) {
        _tipLbl = [[UILabel alloc] initWithFrame:CGRectMake(35.0f, 0.0f, 324.0f, 0.0f)];
        _tipLbl.text = LLang(@"请务必填写正确账号和真实姓名，避免提现发送错误，提现款项会在在三分钟后入账");
        [_tipLbl setFont:[[WKApp shared].config appFontOfSize:12.0f]];
        _tipLbl.numberOfLines = 0;
        [_tipLbl setTextColor:[UIColor colorWithRed:255.0f/255.0f green:109.0f/255.0f blue:67.0f/255.0f alpha:1.0f]];
        [_tipLbl sizeToFit];
        _tipLbl.lim_top = self.tipBox.lim_height/2.0f - _tipLbl.lim_height/2.0f;
    }
    return _tipLbl;
}

-(UIImage*) imageName:(NSString*)name {
    return [[WKApp shared] loadImage:name moduleID:@"LLWallet"];
}

- (void)dealloc {
    [[FFBankcardAddVM shared] clear];
}

@end
